package com.yang.thread.bulid;

/**
 * @author yds
 * @program thread-study
 * @description 实现runnable接口
 * @create 2020-09-22 16:16
 **/
public class ThreadTest2 implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 200; i++) {
            System.out.println("正在学习thread---->"+Thread.currentThread().getName()+i);
        }
    }
    public static void main(String[] args) {
        for (int i = 0; i < 20000; i++) {
            System.out.println("父线程执行代码------>"+Thread.currentThread().getName()+i);
        }
        new Thread(new ThreadTest2(),"子线程").run();//调用run 则只有一个mian线程
        //new Thread(new ThreadTest2(),"子线程").start();//调用start。则mian和子线程并行代码
    }
}